from django.db import models

# Create your models here.
#用户表
class userInfo(models.Model):
    username=models.CharField(max_length=255,null=False)
    password=models.CharField(max_length=255,null=False)
    biography=models.TextField()
#曲目表
class Track(models.Model):
    title=models.CharField(max_length=255,null=False)
    duration=models.DateTimeField(auto_now_add=True,null=False)
#播放记录表
class PlayRecord(models.Model):
    play_date=models.DateTimeField(auto_now_add=True,null=False)
    play_times=models.IntegerField(null=False)
    track_id=models.ForeignKey(Track,on_delete=models.CASCADE,related_name='PlayRecord')
    user_id =models.ForeignKey(userInfo,on_delete=models.CASCADE,related_name='PlayRecord')